﻿//********************************************************************************//
//创建日期：<创建日期，2016-09-18>
//创建作者：<孙雪婷，sunxueting@shanghai3h.com>
//功能说明：采灌计划 采灌比录入
//********************************************************************************//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entity;
using BLL;
using BLL.Access;
using System.Data;
using Platform.Http;
using System.Text;
using Web.Class;

namespace Web.Pages.QuShui.DiXiaS.JiHuaGL.CaiGuanJH
{
    public partial class CaiGuanBLR :BasePage
    {
        #region 属性

        #endregion

        #region 变量
        

        /// <summary>
        /// 存储过程执行类
        /// </summary>
        SpHelper _SpHelper = new SpHelper();

        /// <summary>
        /// 操作日志BLL
        /// </summary>
        SYS_LOGBLL _SYS_LOGBLL = new SYS_LOGBLL();

        /// <summary>
        /// 参数bll
        /// </summary>
        QS_CANSHUBBLL _CANSHUBLL = new QS_CANSHUBBLL();
        #endregion

        #region 事件

        /// <summary>
        /// 页面加载事件
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            //第一次页面加载
            if (!IsPostBack)
            {
                InitData();
            }
            
        }

        /// <summary>
        /// 绑定空表头
        /// </summary>
        protected override void Render(HtmlTextWriter sender)
        {
            base.Render(sender);
        }

        /// <summary>
        /// 保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string value = txtV.Text;
            string outv = "0";
            _SpHelper.P_QSJH_CAIGUANBGB(value, out outv);
            if (outv == "1")
            {
                PageTools.AlertMsg(this, "保存成功！");
            }
            else
            {
                PageTools.AlertMsg(this, "保存失败！");
            }
        }

        /// <summary>
        /// 放弃
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            InitData();
        }
        #endregion

        #region 方法

        /// <summary>
        /// 初始化数据
        /// </summary>
        private void InitData()
        {
            DataTable dt = _CANSHUBLL.SelectQS_CANSHUBsDynamic(string.Format("i_jlzt=0 and S_MINGCHENG='采灌比' or S_MIAOSHU='采灌比'"), null);
            string value = dt.Rows.Count > 0 ? dt.Rows[0]["S_ZHI"].ToString() : "1";
            txtV.Text = value;
            txtV.Focus();
        }
        #endregion        

    }
}